import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class DefaultStyleCell extends StatelessWidget {
  final String? iconPath; // 左侧图标路径
  final String titleLabel; // 主标题
  final String? detailLabel; // 副标题（可选）
  final Color? iconColor; // 图标颜色
  final Color? titleColor; // 主标题颜色
  final Color? detailColor; // 副标题颜色
  final double? height; // 自定义高度
  final double borderRadius; // 新增：圆角半径
  final VoidCallback? onTap; // 点击回调

  const DefaultStyleCell({
    super.key,
    required this.iconPath,
    required this.titleLabel,
    this.detailLabel,
    this.iconColor = const Color(0xFF6F7686),
    this.titleColor = Colors.black,
    this.detailColor = Colors.grey,
    this.height = 66.0,
    this.borderRadius = 8.0, // 默认圆角 8px
    this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      borderRadius: BorderRadius.circular(borderRadius), // 点击水波纹圆角匹配
      child: Container(
        height: height,
        padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(borderRadius), // 设置圆角
        ),
        child: Row(
          children: [
            // 左侧图标
            if (iconPath != null && iconPath!.isNotEmpty)
              Padding(
                padding: EdgeInsets.only(right: 12.w),
                child: Image.asset(
                  iconPath!,
                  width: 24.w,
                  height: 24.w,
                  color: iconColor,
                ),
              ),

            // 中间文字区域
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: height != null
                    ? MainAxisAlignment.center
                    : MainAxisAlignment.start,
                children: [
                  Text(
                    titleLabel,
                    style: TextStyle(fontSize: 16.r, color: titleColor),
                  ),
                  if (detailLabel != null)
                    Padding(
                      padding: const EdgeInsets.only(top: 2),
                      child: Text(
                        detailLabel!,
                        style: TextStyle(fontSize: 14.r, color: detailColor),
                      ),
                    ),
                ],
              ),
            ),

            // 右侧箭头
            Icon(Icons.chevron_right, color: Colors.grey[400], size: 20.w),
          ],
        ),
      ),
    );
  }
}
